<template>
    <div>
      <el-table :data="personalInfoData" style="width: 100%">
        <el-table-column prop="id" label="ID" width="150"></el-table-column>
        <el-table-column prop="name" label="姓名" width="180"></el-table-column>
        <el-table-column prop="age" label="年龄" width="150"></el-table-column>
        <el-table-column prop="gender" label="性别" width="150"></el-table-column>
        <el-table-column prop="tel" label="电话" width="200"></el-table-column>
        <el-table-column prop="address" label="地址"></el-table-column>
        <!-- 其他需要展示的字段 -->
      </el-table>
    </div>
  </template>
  
  <script>
  import { getPersonalInfo } from '@/api/index'; // 引入封装好的axios请求
  
  export default {
    name: 'PersonalInfo',
    data() {
      return {
        personalInfoData: []
      };
    },
    created() {
      this.fetchData();
    },
    methods: {
      fetchData() {
        getPersonalInfo().then(response => {
          // 将axios请求返回的数据赋值给personalInfoData
          this.personalInfoData = response.data.data;
        }).catch(error => {
          console.error('请求错误:', error);
        });
      }
    }
  };
  </script>